Skip to content

Added new params for textInference#287

Open
Sirsho1997 wants to merge 9 commits intomainfrom
feature-updateLLMSettings
Open

Added new params for textInference#287
Sirsho1997 wants to merge 9 commits intomainfrom
feature-updateLLMSettings

Conversation

@Sirsho1997
Copy link
Copy Markdown
Collaborator

@Sirsho1997 Sirsho1997 commented May 4, 2026

Added

  • Added text inference cache support:
    • TextInferenceCacheScope = Literal["system", "system+history"]
    • TextInferenceCacheTtl = Literal["5m", "1h"]
    • ITextInferenceCache dataclass (scope, ttl) with request key cache
  • ITextInputs now includes:
    • documents: Optional[List[Union[str, File]]]
  • ITextInferenceTool now supports:
    • schema: Optional[Dict[str, Any]]
    • backward-compatible input_schema alias (serialized as schema when schema is not provided)
    • optional toolType (serialized as type)
  • Added ITextInferenceToolChoice request serialization support:
    • request_key = "toolChoice"
    • toolType -> type mapping in serialize()

Changed

  • toolChoice moved from ISettings to the root ITextInference payload:
    • ITextInference.toolChoice: Optional[Union[ITextInferenceToolChoice, Dict[str, Any]]]
    • _buildTextRequest() now includes root-level toolChoice
  • Unified text-input media preprocessing in runware/base.py via _processTextInputs() and applied it to both _requestText() and _requestTextStream(), so images/videos/documents are normalized consistently for sync/async/stream text requests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71acc7df-3138-432d-a67b-199c55345de4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature-updateLLMSettings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the text-inference request surface in the SDK by adding new request parameters and preprocessing for an additional input type. It fits into the existing runware.types request-model layer and the runware.base request-building/sending flow for text inference.

Changes:

  • Added new text-inference settings/types for cache control and document inputs.
  • Updated ITextInferenceTool to accept new schema/type-related fields and custom serialization.
  • Added document preprocessing in the non-stream text request path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
runware/types.py Adds new text-inference request models/fields (cache, documents) and changes tool initialization/serialization behavior.
runware/base.py Processes inputs.documents before building non-stream text inference requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runware/types.py
Comment thread runware/base.py Outdated
Comment thread runware/types.py Outdated
Comment thread runware/types.py Outdated
@Sirsho1997 Sirsho1997 changed the title Added supoport for new params Added new params for textInference May 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runware/base.py
Comment thread runware/types.py Outdated
Comment thread runware/types.py
Comment thread runware/types.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

runware/utils.py:56

  • Environment.PRODUCTION WebSocket base URL was changed to wss://ws-api.runware.dev/v1, which looks like a non-production endpoint and also no longer matches the documented production endpoint (wss://ws-api.runware.ai/v1) or the production HTTP base URL (https://api.runware.ai/v1). This will cause default SDK connections (and HTTP streaming URL mapping via _WS_TO_HTTP) to target the wrong host.
BASE_RUNWARE_URLS = {
    Environment.PRODUCTION: "wss://ws-api.runware.dev/v1",
    Environment.TEST: "ws://localhost:8080",
}

# HTTP REST base URL for streaming (e.g. textInference with deliveryMethod=stream)
BASE_RUNWARE_HTTP_URLS = {
    Environment.PRODUCTION: "https://api.runware.ai/v1",
    Environment.TEST: "http://localhost:8080",
}

# Map each WebSocket base URL to its HTTP counterpart (for streaming requests).
_WS_TO_HTTP = {
    BASE_RUNWARE_URLS[Environment.PRODUCTION]: BASE_RUNWARE_HTTP_URLS[Environment.PRODUCTION],
    BASE_RUNWARE_URLS[Environment.TEST]: BASE_RUNWARE_HTTP_URLS[Environment.TEST],
}

Comment thread runware/types.py
Comment thread runware/types.py
Comment thread runware/base.py
Comment thread runware/types.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

runware/utils.py:49

  • Environment.PRODUCTION WebSocket base URL was changed to wss://ws-api.runware.dev/v1, while the production HTTP base URL remains https://api.runware.ai/v1. This likely breaks production connectivity (and creates an inconsistent WS↔HTTP mapping in _WS_TO_HTTP). If this isn't intentional, revert to the .ai endpoint; if it is intentional, the HTTP base URL and docs/config should be updated consistently.
BASE_RUNWARE_URLS = {
    Environment.PRODUCTION: "wss://ws-api.runware.dev/v1",
    Environment.TEST: "ws://localhost:8080",
}

# HTTP REST base URL for streaming (e.g. textInference with deliveryMethod=stream)
BASE_RUNWARE_HTTP_URLS = {
    Environment.PRODUCTION: "https://api.runware.ai/v1",
    Environment.TEST: "http://localhost:8080",

Comment thread runware/types.py
Comment thread runware/types.py
Comment thread runware/base.py
Comment thread runware/types.py
Copy link
Copy Markdown
Contributor

@teith teith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix url and lgtm

Comment thread runware/utils.py

BASE_RUNWARE_URLS = {
Environment.PRODUCTION: "wss://ws-api.runware.ai/v1",
Environment.PRODUCTION: "wss://ws-api.runware.dev/v1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants